<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="
       http://www.springframework.org/schema/beans 
       http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
       http://www.springframework.org/schema/tx 
       http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
       http://www.springframework.org/schema/aop 
       http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
       http://www.springframework.org/schema/context  
       http://www.springframework.org/schema/context/spring-context-3.2.xsd">
	<bean id="propertyPlaceholderConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="classpath:hibernate.properties" />
	</bean>
	<bean id="dataSource" destroy-method="close"
		 class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property name="jdbcUrl" value="${r"${hibernate.connection.url}"}" />
		<property name="driverClass" value="${r"${hibernate.connection.driver_class}"}" />
		<property name="user" value="${r"${hibernate.connection.username}"}" />
		<property name="password" value="${r"${hibernate.connection.password}"}" />
	</bean>
	<bean id="sessionFactory" destroy-method="destroy"
		class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="configLocation" value="classpath:hibernate.cfg.xml" />
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.current_session_context_class">${r"${hibernate.current_session_context_class}"}</prop>
				<prop key="hibernate.dialect">${r"${hibernate.dialect}"}</prop>
				<prop key="hibernate.show_sql">${r"${hibernate.show_sql}"}</prop>
				<prop key="hibernate.format_sql">${r"${hibernate.format_sql}"}</prop>
			</props>
		</property>
	</bean>

	<context:component-scan base-package="${nameInfo.daoImplPackage}" />
	<context:component-scan base-package="${nameInfo.serviceImplPackage}" />

	<bean id="hibernateTransactionManager"
		class="org.springframework.orm.hibernate4.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
	<tx:advice transaction-manager="hibernateTransactionManager"
		id="tx">
		<tx:attributes>
			<tx:method name="query*" propagation="REQUIRED" read-only="true" />
			<tx:method name="save*" propagation="REQUIRED" />
			<tx:method name="delete*" propagation="REQUIRED" />
			<tx:method name="update*" propagation="REQUIRED" />
		</tx:attributes>
	</tx:advice>

	<aop:config>
		<aop:pointcut expression="execution(* ${nameInfo.serviceImplPackage}..*(..))"
			id="pc" />
		<aop:advisor advice-ref="tx" pointcut-ref="pc" />
	</aop:config>

</beans>